package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysAppPrescriptionInfo;
import com.ruoyi.system.mapper.SysAppPrescriptionInfoMapper;
import com.ruoyi.system.service.ISysAppPrescriptionInfoService;

/**
 * 方剂信息内容Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-09-05
 */
@Service
public class SysAppPrescriptionInfoServiceImpl implements ISysAppPrescriptionInfoService {
	@Autowired
	private SysAppPrescriptionInfoMapper sysAppPrescriptionInfoMapper;

	/**
	 * 查询方剂信息内容
	 * 
	 * @param id 方剂信息内容ID
	 * @return 方剂信息内容
	 */
	@Override
	public SysAppPrescriptionInfo selectSysAppPrescriptionInfoById(Long id) {
		return sysAppPrescriptionInfoMapper.selectSysAppPrescriptionInfoById(id);
	}

	/**
	 * 查询方剂信息内容列表
	 * 
	 * @param sysAppPrescriptionInfo 方剂信息内容
	 * @return 方剂信息内容
	 */
	@Override
	public List<SysAppPrescriptionInfo> selectSysAppPrescriptionInfoList(
			SysAppPrescriptionInfo sysAppPrescriptionInfo) {
		sysAppPrescriptionInfo.setSortId(sysAppPrescriptionInfo.getId());
		return sysAppPrescriptionInfoMapper.selectSysAppPrescriptionInfoList(sysAppPrescriptionInfo);
	}

	/**
	 * 新增方剂信息内容
	 * 
	 * @param sysAppPrescriptionInfo 方剂信息内容
	 * @return 结果
	 */
	@Override
	public int insertSysAppPrescriptionInfo(SysAppPrescriptionInfo sysAppPrescriptionInfo) {
		Date date = DateUtils.getNowDate();
		sysAppPrescriptionInfo.setCreateDate(date);
		return sysAppPrescriptionInfoMapper.insertSysAppPrescriptionInfo(sysAppPrescriptionInfo);
	}

	/**
	 * 修改方剂信息内容
	 * 
	 * @param sysAppPrescriptionInfo 方剂信息内容
	 * @return 结果
	 */
	@Override
	public int updateSysAppPrescriptionInfo(SysAppPrescriptionInfo sysAppPrescriptionInfo) {
		return sysAppPrescriptionInfoMapper.updateSysAppPrescriptionInfo(sysAppPrescriptionInfo);
	}

	/**
	 * 删除方剂信息内容对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deleteSysAppPrescriptionInfoByIds(String ids) {
		return sysAppPrescriptionInfoMapper.deleteSysAppPrescriptionInfoByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除方剂信息内容信息
	 * 
	 * @param id 方剂信息内容ID
	 * @return 结果
	 */
	@Override
	public int deleteSysAppPrescriptionInfoById(Long id) {
		return sysAppPrescriptionInfoMapper.deleteSysAppPrescriptionInfoById(id);
	}

	@Override
	public List<SysAppPrescriptionInfo> selectPrescriptionInfoListByClauseId(Long clauseId) {
		// TODO Auto-generated method stub
		return sysAppPrescriptionInfoMapper.selectPrescriptionInfoListByClauseId(clauseId);
	}

	@Override
	public List<SysAppPrescriptionInfo> selectInfoBySortIdOrTitle(SysAppPrescriptionInfo sysAppPrescriptionInfo) {
		return sysAppPrescriptionInfoMapper.selectInfoBySortIdOrTitle(sysAppPrescriptionInfo);
	}

	@Override
	public List<SysAppPrescriptionInfo> selectInfoBySortId(Long sortId) {
		List<SysAppPrescriptionInfo> infos = sysAppPrescriptionInfoMapper.selectInfoBySortId(sortId);
		return infos;
	}

}
